<!--#include file="./doctype.html"-->
<title>模板管理-<%=siteTitle%>-后台管理</title>
</head><body>
<div class="wrap">
    <ol class="breadcrumb">
        <li class="active"><a href="<%=fileName%>">列表首页</a></li>
    </ol>
    <form method="get" action="<%=fileName%>" class="form-inline mb10" role="form">
        <input type="hidden" value="index" name="q">
        <div class="form-group">
            <label for="keyword">模板内容关键字：</label>
            <input type="text" class="form-control input-sm clean" id="keyword" name="keyword" value="<%=app.hec(keyword)%>" placeholder="模板内容关键字">
        </div>
        <button type="submit" class="btn btn-sm btn-primary">确定</button>
    </form>
    <% if isArray(data) then %>
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>模板ID</th>
                    <th>模板名称</th>
                    <th>重新生成</th>
                    <th>模板内容</th>
                    <th>系统模板?</th>
                </tr>
            </thead>
            <tbody>
            <% for i = 0 to ubound(data, 2) %>
                <% Tid = data(0,i) %>
                <tr>
                    <td><label><input type="checkbox" name="batchId" value="<%=Tid%>" /> <%=Tid%></label></td>
                    <td><a href="<%=fileName%>?q=edit&id=<%=Tid%>"><%=data(1,i)%></a></td>
                    <td><span class="btn btn-link btn-xs view_update" data-id="<%=Tid%>">生成文件</span></td>
                    <td><%=Left(app.hec(data(2,i)), 100)%></td>
                    <td class="setBool" data-value="<%=data(3,i)%>"></td>
                </tr>
            <% next %>
            </tbody>
        </table>
        <!--#include file="page.html"-->
		<div class="btn-group">
            <span class="btn btn-sm btn-default selectAll">
                <i class="glyphicon glyphicon-th"></i> 全选/反选
            </span>
            <span class="btn btn-sm btn-default deleteBatch">
                <i class="glyphicon glyphicon-trash"></i> 删除
            </span>
        </div>
    <% else %>
        <!--#include file="noData.html"-->
    <% End if %>
    <!--#include file="loadTime.html"-->
</div>
<script>
$(document).ready(function(){
    $('.setBool').setBool(1);
$(this)
	.on('click', '.view_update', function() {
		var id = $(this).attr('data-id'), url = '<%=fileName%>?q=update&id=' + id;
		$.json(url, function(a) {
			$.message({c: a.message});
		});
	})
	.on('click', '.deleteBatch', function() {
		$.deleteBatch();
	})
});
</script>
</body>
</html>